package hjt.com.module_video;

import android.os.Bundle;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.bumptech.glide.Glide;
import com.tong.lib.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.jzvd.Jzvd;
import hjt.com.componentbase.constant.ARouterConstants;
import hjt.com.module_video.CustomJzvd.MyJzvdStd;
import hjt.com.module_video.CustomMedia.JZMediaIjk;

@Route(path = ARouterConstants.VIDEO_ACTIVITY_VIDEO)
public class VideoActivity extends BaseActivity{


    @BindView(R2.id.jz_video)
    MyJzvdStd jzVideo;

    @Override
    protected int getLayoutResID() {
        return R.layout.video_activity_video;
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        Jzvd.releaseAllVideos();
//        jzVideo.setUp("http://jzvd.nathen.cn/342a5f7ef6124a4a8faf00e738b8bee4/cf6d9db0bd4d41f59d09ea0a81e918fd-5287d2089db37e62345123a1be272f8b.mp4", "饺子快长大");
        jzVideo.setUp("http://video.lanqiuke.com/2019.7.21%E5%AE%9D%E7%9B%962.m3u8", "饺子快长大", Jzvd.SCREEN_NORMAL, JZMediaIjk.class);
        Glide.with(this)
                .load("http://jzvd-pic.nathen.cn/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png")
                .into(jzVideo.thumbImageView);
//        jzVideo.startVideo();

    }

    @Override
    protected void initEvent() {

    }

    @Override
    public void onBackPressed() {
        if (Jzvd.backPress()) {
            return;
        }
        super.onBackPressed();
    }

    @Override
    protected void onPause() {
        super.onPause();
        Jzvd.releaseAllVideos();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
